package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author stone
 * @date 2022/11/16 21:29
 */
@RestController
public class HelloController {


    @RequestMapping("hello1")
    public BaseRespVo hello1() {
        try {
            int i = 1 / 0;
            // 20行
        } catch (Exception exception) {
            //return BaseRespVo.fail(exception.getMessage());
            //exception.printStackTrace();
            return BaseRespVo.ok("应用程序正在升级维护，请稍后");
        }
        return BaseRespVo.ok();
    }

    @RequestMapping("hello2")
    public BaseRespVo hello2() {

        try {
            Integer parse = Integer.valueOf("abc");
            // 10行
        } catch (NumberFormatException e) {
            return BaseRespVo.fail(e.getMessage());
            //e.printStackTrace();
        }
        return BaseRespVo.ok();
    }

    @RequestMapping("hello3")
    public BaseRespVo hello3() {

        int i = 1 / 0;

        return BaseRespVo.ok();
    }

    @RequestMapping("hello4")
    public BaseRespVo hello4() {
        Integer parse = Integer.valueOf("abc");
        return BaseRespVo.ok();
    }

}
